home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Form / Sources / ScrollEd.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.3 KB  |  140 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ScrollEd.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SCROLLED_H
  11. #define SCROLLED_H
  12.  
  13. #ifndef DEFINES_K
  14. #include "Defines.k"
  15. #endif
  16.  
  17. #ifndef FWEDVIEW_H
  18. #include "FWEdView.h"
  19. #endif
  20.  
  21. #ifndef FWRECEVR_H
  22. #include "FWRecevr.h"
  23. #endif
  24.  
  25. #if FW_PPOB_VIEWS
  26. #include "FWPPobOb.h"
  27. #endif
  28.  
  29. #if FW_MACAPP_VIEWS
  30. #include "FWMAObjs.h"
  31. #endif
  32.  
  33. //==============================================================================
  34. // Forward Declarations
  35. //==============================================================================
  36.  
  37. class FW_CScrollBar;
  38. class FW_CNotification;
  39.  
  40. //==============================================================================
  41. // class CScrollEdit
  42. //==============================================================================
  43. // CScrollEdit adds scrolling & undo functionalities to FW_CEditView.
  44. // See CScrollEdit's documentation at the top of the .cpp file
  45.  
  46. class CScrollEdit : public FW_CEditView, public FW_MReceiver
  47. {
  48.   public:
  49.     FW_DECLARE_CLASS
  50.     FW_DECLARE_AUTO(CScrollEdit)
  51.  
  52.     // 1 step constructor
  53.     CScrollEdit(Environment* ev, 
  54.                 FW_CSuperView* container, 
  55.                 const FW_CRect& bounds,
  56.                 ODID viewID, 
  57.                 FW_CScrollBar* horzSB,
  58.                 FW_CScrollBar* vertSB,
  59.                 const FW_CString& text, 
  60.                 const FW_CFont& font = FW_kNormalFont,
  61.                 short maxChars = FW_MAXINT16, 
  62.                 unsigned short attributes = FW_CEditView::kDrawBox + 
  63.                                             FW_CEditView::kWordWrap + 
  64.                                             FW_CEditView::kAutoScroll,
  65.                 FW_Fixed textWidth = FW_kFixed0);
  66.  
  67.     // 2 steps constructor
  68.     CScrollEdit(Environment* ev);
  69.                     
  70.     virtual ~CScrollEdit();
  71.  
  72.     // ----- New API
  73.     void                         UpdateScrollParameters(Environment* ev);
  74.     void                         UpdateScrollUnits(Environment* ev);
  75.     void                         AdjustTE(Environment* ev);
  76.     void                        AdjustTERects(Environment* ev);
  77.     void                        AdjustScrollbar(Environment* ev, FW_XYSelector direction);
  78.     void                         Initialize(Environment* ev);
  79.  
  80.     // ----- Inherited API
  81.     virtual FW_Handled            DoAdjustMenus (Environment *ev, FW_CMenuBar* menuBar, 
  82.                                             FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  83.     virtual FW_Handled             DoMenu (Environment* ev, const FW_CMenuEvent& event);
  84.     virtual FW_Handled             DoMouseDown (Environment* ev, const FW_CMouseEvent& event);
  85.     virtual FW_Handled             DoVirtualKey (Environment* ev, const FW_CVirtualKeyEvent & event);
  86.     virtual FW_Handled             DoCharKey (Environment* ev, const FW_CCharKeyEvent& event);
  87.     virtual void                 HandleNotification(Environment* ev, const FW_CNotification& notification);
  88.     virtual void                 SizeChanged (Environment* ev, const FW_CPoint& oldSize);
  89.     virtual void                 SetText (Environment * ev, const FW_CString& str);
  90.  
  91.     // ----- Archiving -----
  92. #if FW_ODFRC_VIEWS
  93.     static void*                Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  94.     static void                    Destroy(void* object, FW_ClassTypeConstant type);
  95.     virtual void                Flatten(Environment* ev, FW_CWritableStream& stream) const;
  96.     virtual void                InitializeFromStream(Environment* ev, FW_CReadableStream& stream);
  97. #endif
  98.  
  99.   private:
  100.       FW_CScrollBar*         fScrollbars[2];        // vert & horz scrollbars (may be NULL)
  101.     FW_Fixed            fWidth;                // text width
  102. };
  103.  
  104. //========================================================================================
  105. // class CPPobScrollEdit
  106. //========================================================================================
  107. #if FW_PPOB_VIEWS
  108.  
  109. class CPPobScrollEdit : public FW_CPPobTextEdit
  110. {
  111. public:
  112.     FW_DECLARE_AUTO(CPPobScrollEdit)
  113.     CPPobScrollEdit(Environment* ev, FW_CReadableStream& stream, long type);
  114.  
  115.     static void*        Create(Environment* ev, FW_CReadableStream& stream, long type);
  116.     virtual void        CreateODFView(Environment* ev);
  117. };
  118.  
  119. #endif // FW_PPOB_VIEWS
  120.  
  121. //========================================================================================
  122. // class CMAScrollEdit
  123. //========================================================================================
  124. #if FW_MACAPP_VIEWS
  125.  
  126. class CMAScrollEdit : public FW_CMATEView
  127. {
  128. public:
  129.     CMAScrollEdit(ResType type);
  130.     
  131.     static FW_CMAObject*    Create(ResType type);
  132.     virtual FW_CView*        CreateODFView(Environment* ev, FW_CSuperView* superview, FW_MReceiver* receiver);
  133. };
  134.  
  135. #endif // FW_MACAPP_VIEWS
  136.  
  137.  
  138.  
  139. #endif
  140.